#ifndef __GRAPH_CACHE_H__
#define __GRAPH_CACHE_H__
#include "T_BITMAP.h"
#include <map>
#include <string>


class GraphCache{
private:
	GraphCache(){}
protected:
	typedef std::map<std::string,T_BITMAP *> StringedGraphs;
	typedef std::map<int,T_BITMAP *> IntegralGraphs;
	static GraphCache *mCache;
	StringedGraphs m_sGraphs;
	IntegralGraphs m_iGraphs;
public:
	~GraphCache();
	static GraphCache *getInstance(){
		return mCache;
	}
	static GraphCache *create(){
		if(!mCache){
			mCache = new GraphCache();
		}
		return mCache;
	}
	static void release(){
		if(mCache){
			delete mCache;
			mCache = 0;
		}
	}

	bool add(int,T_BITMAP *);
	bool add(const std::string &,T_BITMAP *b);
	T_BITMAP *get(int);
	T_BITMAP* get(const std::string &);
	bool replace(const std::string &,T_BITMAP *b);
	bool remove(const std::string &);
	int getSize();
};
#endif